import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
  Req,
} from '@nestjs/common';
import { MapService } from './map.service';
import { ApiProperty, ApiQuery } from '@nestjs/swagger';

@Controller('map_web')
export class MapController {
  constructor(private readonly mapService: MapService) {}

  // @Post()
  // create(@Body() createMapDto: CreateMapDto) {
  //   return this.mapService.create(createMapDto);
  // }

  // 获取省市信息
  @Get()
  @ApiProperty({ description: '根据省获取市区信息' })
  @ApiQuery({ name: 'province', description: '获取市级信息', required: true })
  findAll(@Req() req, @Query('province') province) {
    return this.mapService.findAll(province);
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.mapService.findOne(+id);
  }

  // @Patch(':id')
  // update(@Param('id') id: string, @Body() updateMapDto: UpdateMapDto) {
  //   return this.mapService.update(+id, updateMapDto);
  // }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.mapService.remove(+id);
  }
}
